# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=qt5-remoteobjects
_basever=5.15.18
pkgver=5.15.18
pkgrel=3
_commit=b2740a7c7f5b6ac810240404a947ca5cff9de5f7
arch=('x86_64' 'aarch64')
url='https://www.qt.io'
license=('GPL-3.0-only' 'LGPL-3.0-only' 'FDL' 'custom')
pkgdesc='Inter-process communication (IPC) module developed for Qt.'
depends=('qt5-base')
makedepends=('qt5-declarative' 'git')
optdepends=('qt5-declarative: QML bindings')
_pkgfqn=${pkgname/5-/}
source=("kde-$_pkgfqn::git+https://invent.kde.org/qt/qt/$_pkgfqn#commit=$_commit")
sha512sums=('832848fbe5f8895b8702c2f0da446375bd6f18fd7e5be3ad5b0b9216cbb24d98be881383ecd59a007349c3681577da6bce16c2d6ca57ceca783cb64057e3fd68')

pkgver() {
  cd "kde-$_pkgfqn"

  echo "$_basever+kde+r"`git rev-list --count v$_basever-lts-lgpl..$_commit` |
    sed -e 's|+kde+r0||'
}

prepare() {
  mkdir -p build
}

build() {
  cd build

  qmake "../kde-$_pkgfqn"

  make
}

package() {
  cd build

  make INSTALL_ROOT="$pkgdir" install

  # Drop QMAKE_PRL_BUILD_DIR because reference the build dir
  find "$pkgdir/usr/lib" -type f -name '*.prl' \
    -exec sed -i -e '/^QMAKE_PRL_BUILD_DIR/d' {} \;

  install -d "$pkgdir/usr/share/licenses"
  ln -s /usr/share/licenses/qt5-base "$pkgdir/usr/share/licenses/$pkgname"
}

